package NC;

public class NC16 {
    public boolean isSymmetric (TreeNode root) {
        // write code here
        if(root==null) return true;
        return check(root.left,root.right);
    }
    public boolean check(TreeNode x,TreeNode y){
        if(x==null && y==null) return true;
        if((x==null && y!=null) ||(x!=null && y==null)) return false;
        return check(x.left,y.right)&&check(x.right,y.left)&&x.val==y.val;
    }
}